// server.js - 服务器启动入口
const app = require('./app');
const dotenv = require('dotenv');
const path = require('path');

// 加载环境变量
dotenv.config({ path: path.resolve(__dirname, '../../.env') });

// 数据库连接
require('./utils/db/mongoose');

// 服务器端口
const PORT = process.env.EXPREES_PORT || 3000;

// 启动服务器
app.listen(PORT, () => {
  console.log(`触发时间：${new Date()}`);
  console.log(`✅ 服务器已启动，监听端口 ${PORT}`);
  console.log(`📁 API调用地址: http://localhost:${PORT}/api`);
  console.log(`📁 API可视化文档: http://localhost:${PORT}/api/doc`);
  console.log(`📁 APIjson化文档: http://localhost:${PORT}/api/doc/json`);
  console.log(`🌐 前端地址: http://localhost:${PORT}`);
}); 